import { EventBus } from "@/tools/bus";
import { wsSend } from "@/tools/sendMessage";
import { pageHandler } from '@/mixins/pageHandler'
import { submitOperateRecord } from "@/api/api";
import ScaleBox from '@/components/ScaleBox/ScaleBox.vue'
import MonitorHeader from '@/components/MonitorHeader/MonitorHeader.vue'
import RuanYaBan from "@/components/controls/RuanYaBan.vue";
import YingYaBan from "@/components/controls/YingYaBan.vue";
import MainBus from "@/components/controls/mainBus.vue";
import TerminalSvg from "@/components/controls/terminal-svg.vue";
import ConnectLine from "@/components/controls/connect-line.vue";
import RectSvg from "@/components/controls/rect-svg.vue";

import KongZhiBaShou from '@/components/controls/KongZhiBaShou.vue'
import RightClickmenuList from '@/components/rightClickmenuList/rightClickMenuList.vue'
import GuapaiDialog from '@/components/rightClickmenuList/guapaiDialog.vue'
import YaokongDialog from '@/components/rightClickmenuList/yaokongDialog.vue'

export default {
	name: 'skewer1IntervalGraph',
	components: {
		RuanYaBan,
		YingYaBan,
		MainBus,
		TerminalSvg,
		ConnectLine,
		RectSvg,
		ScaleBox,
		MonitorHeader,
		KongZhiBaShou,
		RightClickmenuList,
		GuapaiDialog,
		YaokongDialog,
	},
	mixins: [pageHandler],
	data() {
		return {
			tableData: [],
			tableData2: [],
		}
	},
	created() {},
	methods: {
		initData(e) {
		  this.filterData(e)
		},
		filterData(data) {
			let arr = [
				{name: 'Ia', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Ib', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Ic', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Ua', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Ub', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Uc', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Uab', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Ubc', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Uca', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'P', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'Q', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'COS', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'UX', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: 'UO', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: '汇控柜温度', one: '', two: '', three: '', four: '', five: '', unit: ''},
				{name: '汇控柜湿度', one: '', two: '', three: '', four: '', five: '', unit: ''},
			]
			arr.forEach(item => {
				this.pageData['5011'].forEach(itm => {
					if(item.name == itm.state_desc){
						item.one = itm.state_val
						item.unit = itm.unit
					}
				})
				this.pageData['5012'].forEach(itm => {
					if(item.name == itm.state_desc){
						item.two = itm.state_val
					}
				})
				this.pageData['5013'].forEach(itm => {
					if(item.name == itm.state_desc){
						item.three = itm.state_val
					}
				})
				this.pageData['2号主变'].forEach(itm => {
					if(item.name == itm.state_desc){
						item.four = itm.state_val
					}
				})
				this.pageData['桂元I线'].forEach(itm => {
					if(item.name == itm.state_desc){
						item.five = itm.state_val
					}
				})
			})
			this.tableData = arr
			
			let brr = [
				{name: '5011', dlqObj: '', dzObj: '', lsbsObj: '', ykkrObj: ''},
				{name: '5012', dlqObj: '', dzObj: '', lsbsObj: '', ykkrObj: ''},
				{name: '5013', dlqObj: '', dzObj: '', lsbsObj: '', ykkrObj: ''},
			]
			brr.forEach((item, index) => {
				this.pageData['5011'].forEach(itm => {
					if(itm.state_desc == "5011断路器远方就地" && itm.page_position==item.name) {
						item.dlqObj = itm
					}
					if(itm.state_desc == "5011刀闸远方就地" && itm.page_position==item.name) {
						item.dzObj = itm
					}
					if(itm.state_desc == "5011联锁解锁把手" && itm.page_position==item.name) {
						item.lsbsObj = itm
					}
					if(itm.state_desc == "5011远控开入" && itm.page_position==item.name) {
						item.ykkrObj = itm
					}
				})
				this.pageData['5012'].forEach(itm => {
					if(itm.state_desc == "5012断路器远方就地" && itm.page_position==item.name) {
						item.dlqObj = itm
					}
					if(itm.state_desc == "5012刀闸远方就地" && itm.page_position==item.name) {
						item.dzObj = itm
					}
					if(itm.state_desc == "5012联锁解锁把手" && itm.page_position==item.name) {
						item.lsbsObj = itm
					}
					if(itm.state_desc == "5012远控开入" && itm.page_position==item.name) {
						item.ykkrObj = itm
					}
				})
				this.pageData['5013'].forEach(itm => {
					if(itm.state_desc == "5013断路器远方就地" && itm.page_position==item.name) {
						item.dlqObj = itm
					}
					if(itm.state_desc == "5013刀闸远方就地" && itm.page_position==item.name) {
						item.dzObj = itm
					}
					if(itm.state_desc == "5013联锁解锁把手" && itm.page_position==item.name) {
						item.lsbsObj = itm
					}
					if(itm.state_desc == "5013远控开入" && itm.page_position==item.name) {
						item.ykkrObj = itm
					}
				})
			})
			this.tableData2 = brr
		},
		
	},
	mounted() {},
}
